"""insert base data

Revision ID: 897f8157491b
Revises: 855c0783226b
Create Date: 2024-09-10 16:28:57.156092

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision: str = '897f8157491b'
down_revision: Union[str, None] = '855c0783226b'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None



def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    # 插入部门基础数据
    op.execute(
        """
        INSERT INTO `sys_department`(`parentId`, `name`, `phone`, `principal`, `email`, `type`, `status`, `remark`, `id`, `createtime`, `updatetime`, `weight`)
        VALUES
        (NULL, '总公司', '188888888', '董事长', '188888888@qq.com', 'company', 'NORMAL', '总公司', 1, 1723709558, 1723716742, 0),
        (1, '分公司', '199999999', '分公司', '199999999@qq.com', 'company', 'NORMAL', '分公司', 2, 1723715686, 1723723393, 0)
        """
    )

    # # 插入管理员基础数据
    op.execute(
        """
        INSERT INTO `sys_admin`(`nickName`, `userName`, `password`, `avatar`, `mobile`, `email`, `sex`, `status`, `remark`, `id`, `createtime`, `updatetime`, `logintime`, `loginip`, `department_id`)
        VALUES 
        ('admin', 'admin', '$2b$12$NpDn/APmwMAezmlopWjZNe.pU1ELiwxv8Qc8VDSSfZGoPPyTzI.Sm', '/logo.png', '18888888888', 'admin@qq.com', 'MAN', 'NORMAL', '', 1, 1723709558, 1724070392, 1724070392, '127.0.0.1', 1),
        ('此时权限', 'admin2', '$2b$12$VHwWwSxc3cg/rr9NVmpn/eZOPAkm06Caz9MHOHO0.l9Xo88xAMuoa', '/logo.png', '18888888888', '199999999@qq.com', 'MAN', 'NORMAL', '', 2, 1723914156, 1724039395, 1724039395, '127.0.0.1', 2)
        """
    )


    # # 插入角色基础数据
    op.execute(
        """
        INSERT INTO `sys_role`(`name`, `code`, `remark`, `status`, `id`, `parent_id`,  `createtime`, `updatetime`)
        VALUES 
        ('超级管理员', 'admin', '超级管理员', 'NORMAL', 1, NULL, 1723709558, 1723709558),
        ('二级管理员', 'er_admin', '二级管理员', 'NORMAL', 4, 1, 1723739153, 1724037435)
        """
    )

    # #  插入菜单基础数据
    op.execute(
        """
        INSERT INTO `sys_menu`(`menu_type`, `parent_id`, `title`, `name`, `path`, `component`, `rank`, `redirect`, `icon`, `extra_icon`, `enter_transition`, `leave_transition`, `active_path`, `auths`, `frame_src`, `frame_loading`, `keep_alive`, `hidden_tag`, `fixed_tag`, `show_link`, `show_parent`, `id`, `createtime`, `updatetime`, `higher_menu_options`)
        VALUES
        ('MENU', 0, '系统管理', 'system', '/system', '/system', 12, NULL, 'ri:settings-3-line', NULL, NULL, NULL, NULL, NULL, NULL, 'ENABLED', 'CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'SHOW', 1, 1723710526, 1723710526, NULL),
        ('MENU', 1, '用户管理', 'SystemUser', '/system/user/index', 'system/user/index', 12, '', 'ri:admin-line', '', '', '', '', '', '', 'ENABLED', 'CACHE', 'ALLOW', 'FIXED', 'SHOW', 'SHOW', 2, 1723710526, 1724039244, NULL),
        ('MENU', 1, '角色管理', 'SystemRole', '/system/role/index', 'system/role/index', 12, '', 'ri:admin-line', '', '', '', '', '', '', 'ENABLED', 'CACHE', 'ALLOW', 'FIXED', 'SHOW', 'SHOW', 3, 1723710526, 1724039249, NULL),
        ('MENU', 1, '部门管理', 'SystemDept', '/system/dept/index', 'system/dept/index', 12, '', 'ri:git-branch-line', '', '', '', '', '', '', 'ENABLED', 'CACHE', 'ALLOW', 'FIXED', 'SHOW', 'SHOW', 4, 1723710526, 1724039253, NULL),
        ('MENU', 1, '菜单管理', 'SystemMenu', '/system/menu/index', 'system/menu/index', 12, '', 'ri:menu-search-line', '', '', '', '', '', '', 'ENABLED', 'CACHE', 'ALLOW', 'FIXED', 'SHOW', 'SHOW', 6, 1723710526, 1725947754, NULL),
        ('MENU', 0, '系统监管', 'monitor', '/monitor', '', 15, '/monitor/online-user', 'ep:monitor', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'SHOW', 8, 1723784447, 1723798721, '[]'),
        ('MENU', 8, '登录日志', 'LoginLog', '/monitor/login-logs', 'monitor/logs/login/index', 99, '', 'ri:terminal-window-line', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'SHOW', 10, 1723784447, 1723784447, '[]'),
        ('MENU', 8, '操作日志', 'OperationLog', '/monitor/operation-logs', 'monitor/logs/operation/index', 99, '', 'ri:chat-history-line', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'SHOW', 11, 1723784447, 1723784447, '[]'),
        ('BUTTON', 6, '删除', '', '', '', 33, '', '', '', '', '', '', 'system_admin_menu_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 33, 1723913185, 1723913361, '[]'),
        ('BUTTON', 6, '创建', '', '', '', 34, '', '', '', '', '', '', 'system_admin_menu_add', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 34, 1723913185, 1723913185, '[]'),
        ('BUTTON', 6, '修改', '', '', '', 35, '', '', '', '', '', '', 'system_admin_menu_edit', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 35, 1723913745, 1723913745, '[]'),
        ('BUTTON', 6, '列表', '', '', '', 36, '', '', '', '', '', '', 'system_admin_menu_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 36, 1723913745, 1723913745, '[]'),
        ('BUTTON', 6, '详情', '', '', '', 37, '', '', '', '', '', '', 'system_admin_menu_info', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 37, 1723913745, 1723913745, '[]'),
        ('BUTTON', 6, '所有菜单', '', '', '', 38, '', '', '', '', '', '', 'system_admin_menu_all', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 38, 1723913745, 1723913745, '[]'),
        ('MENU', 0, '常规配置', 'AdminGenera', '/general', '', 40, '/general/profile/index', 'ep:calendar', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 40, 1723995780, 1723996503, '[]'),
        ('MENU', 40, '系统配置', 'AdminGeneralConfig', '/general/config', 'general/config/index', 41, '', 'ep:fold', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 41, 1723995780, 1724039271, '[]'),
        ('MENU', 40, '附件管理', 'AdminGeneralAttachment', '/general/attachment', 'general/attachment/index', 42, '', 'ep:burger', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 42, 1723995780, 1724039278, '[]'),
        ('MENU', 40, '个人详情', 'AdminGeneralProfile', '/general/profile', 'general/profile/index', 43, '', 'ri:user-3-fill', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 43, 1723995780, 1724039282, '[]'),
        ('BUTTON', 10, '查询列表', '', '', '', 46, '', '', '', '', '', '', 'system_monitor_logs_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 46, 1724037570, 1724037570, '[]'),
        ('BUTTON', 10, '批量删除', '', '', '', 47, '', '', '', '', '', '', 'system_monitor_logs_del_batch', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 47, 1724037570, 1724037570, '[]'),
        ('BUTTON', 10, '清除所有', '', '', '', 48, '', '', '', '', '', '', 'system_monitor_logs_del_all', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 48, 1724037847, 1724037847, '[]'),
        ('BUTTON', 11, '查询列表', '', '', '', 49, '', '', '', '', '', '', 'system_monitor_operation_logs_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 49, 1724037847, 1724037847, '[]'),
        ('BUTTON', 11, '批量删除', '', '', '', 50, '', '', '', '', '', '', 'system_monitor_operation_logs_del_batch', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 50, 1724037847, 1724037847, '[]'),
        ('BUTTON', 11, '清除所有', '', '', '', 51, '', '', '', '', '', '', 'system_monitor_operation_logs_del_all', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 51, 1724037847, 1724037847, '[]'),
        ('BUTTON', 4, '添加', '', '', '', 52, '', '', '', '', '', '', 'system_admin_dep_add', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 52, 1724037847, 1724037847, '[]'),
        ('BUTTON', 4, '删除', '', '', '', 53, '', '', '', '', '', '', 'system_admin_dep_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 53, 1724037847, 1724037847, '[]'),
        ('BUTTON', 4, '修改', '', '', '', 54, '', '', '', '', '', '', 'system_admin_dep_edit', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 54, 1724037847, 1724037847, '[]'),
        ('BUTTON', 4, '获取列表', '', '', '', 55, '', '', '', '', '', '', 'system_admin_dep_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 55, 1724037847, 1724037847, '[]'),
        ('BUTTON', 4, '获取所有', '', '', '', 56, '', '', '', '', '', '', 'system_admin_dep_all', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 56, 1724037847, 1724037847, '[]'),
        ('BUTTON', 4, '获取详情', '', '', '', 57, '', '', '', '', '', '', 'system_admin_dep_info', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 57, 1724037847, 1724037847, '[]'),
        ('BUTTON', 3, '添加', '', '', '', 58, '', '', '', '', '', '', 'system_admin_role_add', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 58, 1724037847, 1724038030, '[]'),
        ('BUTTON', 3, '删除', '', '', '', 59, '', '', '', '', '', '', 'system_admin_role_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 59, 1724037847, 1724037847, '[]'),
        ('BUTTON', 3, '修改', '', '', '', 60, '', '', '', '', '', '', 'system_admin_role_edit', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 60, 1724037847, 1724037847, '[]'),
        ('BUTTON', 3, '状态修改', '', '', '', 61, '', '', '', '', '', '', 'system_admin_role_status', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 61, 1724037847, 1724037847, '[]'),
        ('BUTTON', 3, '列表', '', '', '', 62, '', '', '', '', '', '', 'system_admin_role_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 62, 1724037847, 1724037847, '[]'),
        ('BUTTON', 3, '所有', '', '', '', 63, '', '', '', '', '', '', 'system_admin_role_all', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 63, 1724037847, 1724037847, '[]'),
        ('BUTTON', 3, '详情', '', '', '', 64, '', '', '', '', '', '', 'system_admin_role_info', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 64, 1724037847, 1724037847, '[]'),
        ('BUTTON', 3, '权限分配', '', '', '', 65, '', '', '', '', '', '', 'system_admin_role_assign', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 65, 1724037847, 1724037847, '[]'),
        ('BUTTON', 3, '查询角色权限', '', '', '', 66, '', '', '', '', '', '', 'system_admin_role_menu', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 66, 1724037847, 1724037847, '[]'),
        ('BUTTON', 3, '所有角色权限', '', '', '', 67, '', '', '', '', '', '', 'system_admin_roles_menu', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 67, 1724037847, 1724037847, '[]'),
        ('BUTTON', 2, '添加', '', '', '', 68, '', '', '', '', '', '', 'system_admin_user_add', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 68, 1724037847, 1724037847, '[]'),
        ('BUTTON', 2, '删除', '', '', '', 69, '', '', '', '', '', '', 'system_admin_user_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 69, 1724037847, 1724037847, '[]'),
        ('BUTTON', 2, '修改', '', '', '', 70, '', '', '', '', '', '', 'system_admin_user_edit', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 70, 1724037847, 1724037847, '[]'),
        ('BUTTON', 2, '列表', '', '', '', 71, '', '', '', '', '', '', 'system_admin_user_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 71, 1724037847, 1724037847, '[]'),
        ('BUTTON', 2, '批量删除', '', '', '', 72, '', '', '', '', '', '', 'system_admin_user_batch_delete', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 72, 1724037847, 1724037847, '[]'),
        ('BUTTON', 2, '状态修改', '', '', '', 73, '', '', '', '', '', '', 'system_admin_user_status', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 73, 1724037847, 1724037847, '[]'),
        ('BUTTON', 2, '查询角色', '', '', '', 74, '', '', '', '', '', '', 'system_admin_user_roles', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 74, 1724037847, 1724037847, '[]'),
        ('BUTTON', 2, '分配角色', '', '', '', 75, '', '', '', '', '', '', 'system_admin_user_assign', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 75, 1724037847, 1724037847, '[]'),
        ('BUTTON', 2, '重置密码', '', '', '', 76, '', '', '', '', '', '', 'system_admin_user_rest_password', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 76, 1724037847, 1724037847, '[]'),
        ('BUTTON', 2, '更新头像', '', '', '', 77, '', '', '', '', '', '', 'system_admin_user_update_avatar', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 77, 1724037847, 1724037847, '[]'),
        ('BUTTON', 2, '详情', '', '', '', 78, '', '', '', '', '', '', 'system_admin_user_info', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 78, 1724037847, 1724037847, '[]'),
        ('MENU', 8, '任务管理', 'MonitorTask', '/monitor/task/index', 'monitor/task/index', 79, '', 'ep:alarm-clock', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 79, 1725589249, 1725589812, '[]'),
        ('BUTTON', 79, '添加', '', '', '', 81, '', '', '', '', '', '', 'system_admin_monitor_task_add', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 81, 1725947724, 1725947724, '[]'),
        ('BUTTON', 79, '暂停', '', '', '', 82, '', '', '', '', '', '', 'system_admin_monitor_task_pause', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 82, 1725947724, 1725947724, '[]'),
        ('BUTTON', 79, '恢复', '', '', '', 83, '', '', '', '', '', '', 'system_admin_monitor_task_resume', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 83, 1725947724, 1725947972, '[]'),
        ('BUTTON', 79, '删除', '', '', '', 84, '', '', '', '', '', '', 'system_admin_monitor_task_delete', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 84, 1725947724, 1725947724, '[]'),
        ('BUTTON', 79, '执行', '', '', '', 85, '', '', '', '', '', '', 'system_admin_monitor_task_run', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 85, 1725947724, 1725947724, '[]'),
        ('BUTTON', 79, '查询列表', '', '', '', 86, '', '', '', '', '', '', 'system_admin_monitor_task_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 86, 1725947724, 1725947724, '[]'),
        ('BUTTON', 79, '任务记录', '', '', '', 87, '', '', '', '', '', '', 'system_admin_monitor_task_record', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 87, 1725947724, 1725947724, '[]'),
        ('BUTTON', 79, '导出任务', '', '', '', 88, '', '', '', '', '', '', 'system_admin_monitor_task_export', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 88, 1725947724, 1725947724, '[]'),
        ('BUTTON', 42, '删除', '', '', '', 89, '', '', '', '', '', '', 'system_admin_attachment_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 89, 1725947724, 1725947724, '[]'),
        ('BUTTON', 42, '批量删除', '', '', '', 90, '', '', '', '', '', '', 'system_admin_attachment_batch_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 90, 1725948121, 1725948121, '[]'),
        ('BUTTON', 42, '修改', '', '', '', 91, '', '', '', '', '', '', 'system_admin_attachment_category', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 91, 1725948121, 1725948121, '[]'),
        ('BUTTON', 42, '添加', '', '', '', 92, '', '', '', '', '', '', 'system_admin_attachment_add', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 92, 1725948121, 1725948121, '[]'),
        ('BUTTON', 41, '添加配置', '', '', '', 93, '', '', '', '', '', '', 'system_admin_config_add', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 93, 1726823613, 1726823613, '[]'),
        ('BUTTON', 41, '配置删除', '', '', '', 94, '', '', '', '', '', '', 'system_admin_config_delete', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 94, 1726823613, 1726823613, '[]'),
        ('BUTTON', 41, '配置更新', '', '', '', 95, '', '', '', '', '', '', 'system_admin_config_update', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 95, 1726823613, 1726823613, '[]'),
        ('BUTTON', 41, '配置批量更新', '', '', '', 96, '', '', '', '', '', '', 'system_admin_config_batch_update', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 96, 1726823613, 1726823613, '[]'),
        ('BUTTON', 41, '配置列表', '', '', '', 97, '', '', '', '', '', '', 'system_admin_config_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 97, 1726823613, 1726823613, '[]'),
        ('BUTTON', 42, '附件类型', '', '', '', 99, '', '', '', '', '', '','system_admin_attachmenttype_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 99, 1727011346, 1727011346, '[]'),
        ('BUTTON', 42, '附件列表', '', '', '', 100, '', '', '', '', '', '', 'system_admin_attachment_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 100, 1727011346, 1727011346, '[]'),
        ('BUTTON', 42, '修改分类', '', '', '', 101, '', '', '', '', '', '', 'system_admin_attachment_update_category', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 101, 1727011346, 1727011346, '[]'),
        ('MENU', 0, '用户管理', 'User', '/user', '', 102, '', 'ep:user', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 102, 1727660742, 1727661195, '[]'),
        ('MENU', 102, '会员管理', 'UserUser', '/user/user/index', 'user/user/index', 103, '', 'ep:user-filled', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 103, 1727660742, 1728373032, '[]'),
        ('MENU', 102, '角色组', 'UserGroup', '/user/group/index', 'user/group/index', 109, '', 'ri:folder-user-fill', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 104, 1727660742, 1728373027, '[]'),
        ('MENU', 102, '用户权限', 'UserRule', '/user/rule/index', 'user/rule/index', 105, '', 'ri:pencil-ruler-line', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 105, 1727660742, 1728373021, '[]'),
        ('MENU', 8, '短信管理', 'MonitorSms', '/monitor/sms/index', 'monitor/sms/index', 107, '', 'fa-solid:sms', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 107, 1728355296, 1728373064, '[]'),
        ('BUTTON', 107, '删除', '', '', '', 108, '', '', '', '', '', '', 'system_admin_sms_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 108, 1728355296, 1728355296, '[]'),
        ('BUTTON', 107, '批量删除', '', '', '', 109, '', '', '', '', '', '', 'system_admin_sms_batch_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 109, 1728355296, 1728355296, '[]'),
        ('BUTTON', 107, '查看列表', '', '', '', 110, '', '', '', '', '', '', 'system_admin_sms_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 110, 1728355296, 1728355296, '[]'),
        ('BUTTON', 103, '导出', '', '', '', 111, '', '', '', '', '', '', 'user_user_export', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 111, 1728360648, 1728360648, '[]'),
        ('BUTTON', 103, '修改状态', '', '', '', 112, '', '', '', '', '', '', 'user_user_change_status', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 112, 1728360648, 1728360648, '[]'),
        ('BUTTON', 103, '修改头像', '', '', '', 113, '', '', '', '', '', '', 'user_user_edit_avatar', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 113, 1728360648, 1728360648, '[]'),
        ('BUTTON', 103, '修改密码', '', '', '', 114, '', '', '', '', '', '', 'user_user_reset_password', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 114, 1728360648, 1728360648, '[]'),
        ('BUTTON', 103, '批量删除', '', '', '', 115, '', '', '', '', '', '', 'user_user_batch_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 115, 1728360648, 1728360648, '[]'),
        ('BUTTON', 103, '查看列表', '', '', '', 116, '', '', '', '', '', '', 'user_user_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 116, 1728360648, 1728360648, '[]'),
        ('BUTTON', 103, '修改', '', '', '', 117, '', '', '', '', '', '', 'user_user_edit', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 117, 1728360648, 1728360648, '[]'),
        ('BUTTON', 103, '添加', '', '', '', 118, '', '', '', '', '', '', 'user_user_add', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 118, 1728360648, 1728360648, '[]'),
        ('BUTTON', 103, '删除', '', '', '', 119, '', '', '', '', '', '', 'user_user_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 119, 1728360648, 1728360648, '[]'),
        ('BUTTON', 104, '导出', '', '', '', 120, '', '', '', '', '', '', 'user_group_export', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 120, 1728360648, 1728360648, '[]'),
        ('BUTTON', 104, '所有角色权限', '', '', '', 121, '', '', '', '', '', '', 'user_group_rule_all', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 121, 1728360648, 1728360648, '[]'),
        ('BUTTON', 104, '角色权限', '', '', '', 122, '', '', '', '', '', '', 'user_group_rule', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 122, 1728360648, 1728360648, '[]'),
        ('BUTTON', 104, '角色分配权限', '', '', '', 123, '', '', '', '', '', '', 'user_group_assign', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 123, 1728360648, 1728360648, '[]'),
        ('BUTTON', 104, '角色信息', '', '', '', 124, '', '', '', '', '', '', 'user_group_info', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 124, 1728360648, 1728360648, '[]'),
        ('BUTTON', 104, '所有角色', '', '', '', 125, '', '', '', '', '', '', 'user_group_all', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 125, 1728360648, 1728360648, '[]'),
        ('BUTTON', 104, '角色组列表', '', '', '', 126, '', '', '', '', '', '', 'user_group_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 126, 1728360648, 1728360648, '[]'),
        ('BUTTON', 104, '角色组状态修改', '', '', '', 127, '', '', '', '', '', '', 'user_group_change_status', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 127, 1728360648, 1728360648, '[]'),
        ('BUTTON', 104, '修改', '', '', '', 128, '', '', '', '', '', '', 'user_group_edit', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 128, 1728360648, 1728360648, '[]'),
        ('BUTTON', 104, '删除', '', '', '', 129, '', '', '', '', '', '', 'user_group_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 129, 1728360648, 1728360648, '[]'),
        ('BUTTON', 104, '添加', '', '', '', 130, '', '', '', '', '', '', 'user_group_add', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 130, 1728360648, 1728360648, '[]'),
        ('BUTTON', 105, '导出', '', '', '', 131, '', '', '', '', '', '', 'user_rule_export', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 131, 1728360648, 1728360648, '[]'),
        ('BUTTON', 105, '查看所有', '', '', '', 132, '', '', '', '', '', '', 'user_rule_all', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 132, 1728360648, 1728360648, '[]'),
        ('BUTTON', 105, '列表', '', '', '', 133, '', '', '', '', '', '', 'user_rule_list', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 133, 1728360648, 1728360648, '[]'),
        ('BUTTON', 105, '编辑', '', '', '', 134, '', '', '', '', '', '', 'user_rule_edit', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 134, 1728360648, 1728360648, '[]'),
        ('BUTTON', 105, '删除', '', '', '', 135, '', '', '', '', '', '', 'user_rule_del', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 135, 1728360648, 1728360648, '[]'),
        ('BUTTON', 105, '添加', '', '', '', 136, '', '', '', '', '', '', 'user_rule_add', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 136, 1728360648, 1728360648, '[]'),
        ('MENU', 102, '空菜单（test）', 'user_test_test', 'user/user/index', '', 137, '', '', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'HIDE', 'HIDE', 137, 1728380551, 1728380551, '[]')
        """
    )

    # # # 插入角色菜单关联基础数据
    op.execute(
        """
        INSERT INTO `sys_role_menu_link`(`role_id`, `menu_id`) 
        VALUES 
        (4, 4)
        """
    )


    # 插入角色和管理员关联基础数据
    op.execute(
        """
        INSERT INTO `sys_admin_role_link`(`admin_id`, `role_id`) 
        VALUES 
        (1, 1),
        (2, 4)
        """
    )

    # 添加默认配置
    op.execute(
        """
        INSERT INTO `sys_config`(`id`, `type`, `title`, `value`, `options`, `description`, `weigh`, `store_range`, `rule`, `code`, `parent_code`)
        VALUES 
        (1, 'group', '基础配置', '', '', '基础配置', 50, NULL, 'required', 'base', NULL),
        (2, 'string', '站点标题', '站点标题', '', '站点标题', 50, NULL, 'required', 'tite', 'base'),
        (3, 'group', '邮箱配置', '', '', '邮箱配置', 50, NULL, 'required', 'email', NULL),
        (5, 'string', '备案号', '', '', '网站备案号（粤ICP备15000000号-1）', 50, NULL, 'required', 'beian', 'base'),
        (6, 'string', '版本号', '1.0.1', '', '网站版本号', 50, NULL, 'required', 'version', 'base'),
        (7, 'text', '禁止IP', '', '', '网站禁止IP(，号分割)', 50, NULL, 'required', 'forbiddenip', 'base'),
        (8, 'select', '发送方式', 'SMTP', 'SMTP', '邮件发送方式', 50, NULL, 'required', 'mail_type', 'email'),
        (9, 'string', 'SMTP服务器', 'smtp.qq.com', '', '错误的配置发送邮件会导致服务器超时', 50, NULL, 'required', 'mail_smtp_host', 'email'),
        (10, 'string', 'SMTP端口', '465', '', '(不加密默认25,SSL默认465,TLS默认587)', 50, NULL, 'required', 'mail_smtp_port', 'email'),
        (11, 'string', 'SMTP用户名', '', '', '填写完整用户名', 50, NULL, 'required', 'mail_smtp_user', 'email'),
        (12, 'string', 'SMTP密码', '', '', '填写您的密码或授权码', 50, NULL, 'required', 'mail_smtp_pass', 'email'),
        (13, 'select', 'SMTP验证方式', '无', '无,TLS,SSL', 'SMTP验证方式[推荐SSL]', 50, NULL, 'required', 'mail_verify_type', 'email'),
        (14, 'string', '发件人邮箱', '', '', '发件人邮箱', 50, NULL, 'required', 'mail_from', 'email')
        """
    )

    # 角色权限插入数据
    op.execute(
        """
        INSERT INTO `game_user_rule`(`menu_type`, `parent_id`, `title`, `name`, `path`, `component`, `rank`, `redirect`, `icon`, `extra_icon`, `enter_transition`, `leave_transition`, `active_path`, `auths`, `frame_src`, `frame_loading`, `keep_alive`, `hidden_tag`, `fixed_tag`, `show_link`, `show_parent`, `id`, `createtime`, `updatetime`, `higher_menu_options`)
        VALUES
        ('MENU', 0, '登录', 'login', 'login', '', 1, '', '', '', '', '', '', '', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 1, 1727662397, 1728390936, '[]'),
        ('BUTTON', 1, '测试', '', '', '', 1, '', '', '', '', '', '', 'test', '', 'ENABLED', 'NO_CACHE', 'ALLOW', 'NOT_FIXED', 'SHOW', 'HIDE', 2, 1727662397, 1728390946, '[]')
        """
    )

    # 用户角色组
    op.execute(
        """
        INSERT INTO `game_user_group`(`name`, `code`, `remark`, `status`, `parent_id`, `createtime`, `updatetime`)
        VALUES
        ('超级用户', 'all', '所有权限', 'NORMAL', 0, 1727669267, 1728384107),
        ('会员', 'member', '', 'NORMAL', 1, 1727662650, 1728384075),
        ('默认', 'base', '', 'NORMAL', 1, 1728383090, 1728383090)
        """
    )

    # 角色权限关联
    op.execute(
        """
        INSERT INTO `game_group_rule_link`(`group_id`, `rule_id`)
        VALUES
        (2, 1),
        (2, 2)
        """
    )

    # # ### end Alembic commands ###

def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    # 禁用外键约束检查
    op.execute("SET FOREIGN_KEY_CHECKS = 0;")
    # 删除角色菜单关联基础数据
    op.execute("DELETE FROM `sys_role_menu_link`")
    # 删除角色和管理员关联基础数据
    op.execute("DELETE FROM `sys_admin_role_link`")
    # 删除登录日志基础数据
    op.execute("DELETE FROM `sys_admin_login_record`")
    # 删除管理员日志基础数据
    op.execute("DELETE FROM `sys_admin_record`")
    # 删除管理员基础数据
    op.execute("DELETE FROM `sys_admin`")
    # 删除所有部门基础数据
    op.execute("DELETE FROM `sys_department`")
    # 删除所有菜单基础数据
    op.execute("DELETE FROM `sys_menu`")
    # 删除角色基础数据
    op.execute("DELETE FROM `sys_role`")
    # 重新启用外键约束检查
    op.execute("SET FOREIGN_KEY_CHECKS = 1;")
    # 删除默认配置
    op.execute("DELETE FROM `sys_config`")
    # 删除角色权限关联
    op.execute("DELETE FROM `game_group_rule_link`")
    # 删除用户角色组
    op.execute("DELETE FROM `game_user_group`")
    # 删除角色权限
    op.execute("DELETE FROM `game_user_rule`")
    # ### end Alembic commands ###
